<?php
if(isset($_POST['op']) && isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower($_SERVER["HTTP_X_REQUESTED_WITH"])=="xmlhttprequest"){
    
    include '../c/config.php';
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    $openid= addslashes($_POST['op']);
    $queryG=$mysqli->query("SELECT count(id) as count FROM `y1_fen_log` where openid='".$openid."' ");
    $getGame=$queryG->fetch_assoc();
   // $getGame['count']=0;
    if($getGame['count'] > 1){
      
      $queryShare=$mysqli->query("SELECT count(id) as count FROM `y1_share` where woid='".$openid."' ");
      $getShare=$queryShare->fetch_assoc();
      $shareNum=$getShare['count'];
      if($shareNum > 10){
        $shareNum=10;
      }
      if($shareNum > 0){
          $maxNum=1 + $shareNum;
          if($getGame['count'] > $maxNum){
             echo json_encode(array('s'=>'n')); 
          }else{
             echo json_encode(array('s'=>'y'));  
          }
      }else{
         echo json_encode(array('s'=>'n')); 
      }
      
 
    }else{
       echo json_encode(array('s'=>'y')); 
    }
 
    $mysqli->close();
   
    
    
}else{
echo json_encode(array('s'=>'n'));
 
}
 
?>